def sum_square(n):
    sum_num=0
    for i in str(n):
        sum_num+=int(i)**2
    return sum_num

list1=[]
n=int(input('请输入数字：'))
while sum_square(n) not in list1:
    n=sum_square(n)
    list1.append(n)
if n==1:
    print('是快乐数')
else:
    print('不是快乐数')